#ifndef RAY_TRACE_PRO_LIGHT_H
#define RAY_TRACE_PRO_LIGHT_H

#include "VectorMath.h"

namespace RayTracePro
{
	using namespace GxLibMath;
	class Scene;

	class Light
	{
	public:
		bool Cutoff;
		bool IsDirectional;
		bool CastShadow;
		enum DecayType
		{
			None, Linear, Quadric
		};
		DecayType Decay;
		Vec3 Position, Direction;
		Vec3 Intensity;
		float StartCutoffCos, FullCutoffCos;
		float StartCutoffAngle, HalfCutoffAngle;
		float RcpHalfMinusStart, RcpFullMinusHalf;
		float DecayFactor;
		Light()
		{
			CastShadow = true;
			Cutoff = IsDirectional = false;
			Decay = Light::None;
			Position.SetZero();
			Direction.SetZero();
			Intensity = Vec3(1.0f, 1.0f, 1.0f);
			StartCutoffCos = FullCutoffCos = 0.0f;
			StartCutoffAngle = HalfCutoffAngle = 0.0f;
			DecayFactor = 1.0f;
		}
		void SetCutoff(float start, float half, float full)
		{
			StartCutoffCos = cos(start);
			FullCutoffCos = cos(full);
			StartCutoffAngle = start;
			HalfCutoffAngle = half;
			RcpHalfMinusStart = 1.0f / (half - start);
			RcpFullMinusHalf = 1.0f / (full - half);
		}
	};
}

#endif